package com.gxg.services;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.stereotype.Service;

@Service
public class CheckEmailService
{
  public Boolean checkEmail(String email)
  {
    String RULE_EMAIL = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
    
    Pattern pattern = Pattern.compile(RULE_EMAIL);
    
    Matcher matcher = pattern.matcher(email);
    
    return Boolean.valueOf(matcher.matches());
  }
}
